package dynamicJsonVerifyer.verifyers;

import com.alibaba.fastjson.JSONObject;
import dynamicJsonVerifyer.Const.*;

import java.util.Map;

public class AbsTextVerifyer extends FieldTypeVerifyer{


    protected String getType() {
        return BaseVerifyDataType.text;
    }

    protected boolean verifyType(JSONObject verifyMetadata, Object appointVaildData) {

        if(appointVaildData instanceof String){
            if("".equals(appointVaildData) && verifyMetadata.containsKey(VaildMetadataItem.canEmpty)){
                return Integer.valueOf(verifyMetadata.get(VaildMetadataItem.canEmpty).toString()) == 1;
            }
            return true;
        }

        return false;
    }
}
